package com.fuyao.cloud.admin.flow.dto;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.Map;

@Data
public class StartProcessDTO {
    @ApiModelProperty(value = "流程定义key", required = true)
    private String processDefinitionKey;
    /**
     * 业务系统id 必填
     */
    @ApiModelProperty(value = "业务表单 ID", required = true)
    private String formId;

    @ApiModelProperty(value = "业务表单唯一标识")
    private String businessKey;
    /**
     * 启动流程变量 选填
     */
    @ApiModelProperty(value = "启动流程变量")
    private Map<String, Object> variables;
    /**
     * 表单显示名称 必填
     */
    @ApiModelProperty(value = "任务标题", required = true)
    private String title;

    public String getBusinessKey() {
        if (this.businessKey == null || this.businessKey.trim().length() == 0) {
            return this.processDefinitionKey + ':' + this.formId;
        } else {
            return this.businessKey;
        }
    }
}
